<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
<title>我的草稿</title>
<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
<link rel="stylesheet" type="text/css" href="../../css/common.css" />
<style>

</style>
</head>

<body>
	<header class="aui-bar aui-bar-nav aui-bar-light" id="header">
        <div class="aui-pull-left back" tapmode onclick="api.closeWin()"></div>
				<div class="aui-title">我的草稿</div>
        <div class="aui-pull-right" tapmode onclick="delDraft()">删除</div>
    </header>
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
		var itemId;
    apiready = function() {
        api.parseTapmode();
				var header = $api.byId('header');
        $api.fixStatusBar(header);
        var headerH = $api.offset(header).h;
        api.openFrame({
            name: 'my_draft_frm',
            url: 'my_draft_frm.html',
            rect: {
                x: 0,
                y: headerH,
                w: 'auto',
                h: 'auto'
            },
						bounces: false,
            pageParam: api.pageParam
        });
				api.addEventListener({
						name: 'idArrEvent'
				}, function(ret, err){
						if( ret ){
							itemId = ret.value.idArr;
						}else{
								 alert( JSON.stringify( err ) );
						}
				});
    };
		function delDraft(){
			if(itemId == undefined){
				toast('请选择')
				return false;
			}
			var confirmMaskTxt = ['确认删除该存草稿吗？','取消','确认'];
			openConfirmMask(confirmMaskTxt,'del()');
		}
		function del(){
			api.ajax({
			    url: BASE_URL + 'App/Article/articleDelete',
			    method: 'post',
			    data: {
			        values: {
			            userid: getUserId(),
									id: itemId
			        }
			    }
			},function(ret, err){
			    if (ret && ret.code == 1) {
			        toast(ret.msg);
							api.sendEvent({
									name: 'delSuccessEvent'
							});

			    } else {
						toast(ret.msg)

			    }
			});

		}
</script>
</html>
